#ifndef Tui_TBar_h
#define Tui_TBar_h

#include "TMaskPanel.h"
#include "CCControl.h"
#include "CCControlSlider.h"


class TBar:public TPanel{
    
public:
    CREATE_FUNC(TBar);
    
    virtual bool init();
    
    TBar();
    
    virtual~TBar();
    
    
    void setSource(const char*);
    
    static TBar* create(xml_node<> * pItem);
    virtual  void initWidthConf(xml_node<> * pItem);
    
    virtual void visit();
    
    virtual void  afterDraw();
    
    virtual void  beforeDraw();
    void setNum(long lCur,long lMax);
    
    void setPer(float num);
    
protected:
    float m_nPer;
    CCSprite* m_pItem;
};




class TEditBar:public TPanel{
    
public:
    TEditBar();
    CREATE_FUNC(TEditBar); 
     
    
    static TEditBar* create(xml_node<> * pItem);
    virtual  void initWidthConf(xml_node<> * pItem);
    
    float getPer();
    void setPer(float num);
    void setChangeTarget(CCObject*   ,SEL_MenuHandler);
protected:
    void valueChanged(CCObject *sender, CCControlEvent controlEvent);
    CCObject*       m_pMoveListener;
    SEL_MenuHandler    m_pMovefnSelector;
    CCControlSlider* controller;
};


    
#endif
